# $Id: PKGBUILD 89852 2013-05-03 14:45:12Z dwallace $
# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Alfredo Palhares <masterkorp@masterkorp.net>

pkgname=hub
_pkgdir=defunkt-hub-
pkgver=1.10.6
pkgrel=1
pkgdesc="cli interface for Github"
arch=('any')
url="http://defunkt.io/hub"
depends=('git' 'ruby')
license=('MIT')
source=("$pkgname-$pkgver.tar.gz::https://github.com/defunkt/hub/tarball/v$pkgver")
sha256sums=('0403b6beb4f9a2da68a0b042f6921ae857513aff9237d37a9462432746db2d06')

build() {
  cd "$srcdir/$_pkgdir"*

  rake standalone
  gzip --best -c man/hub.1> hub.1.gz

}

package() {
  cd "$srcdir/$_pkgdir"*

  install -Dm755 "$srcdir/$_pkgdir"*"/$pkgname" "$pkgdir/usr/bin/$pkgname"

  install -d "$pkgdir/usr/share/$pkgname"
  cp -dpr --no-preserve=ownership "$srcdir/$_pkgdir"*"/git-hooks" "$pkgdir/usr/share/$pkgname/git-hooks"

  install -Dm644 "$srcdir/$_pkgdir"*"/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 "$srcdir/$_pkgdir"*"/etc/hub.bash_completion.sh" "$pkgdir/usr/share/bash-completion/completions/hub"
  install -Dm644 "$srcdir/$_pkgdir"*"/etc/hub.zsh_completion" "$pkgdir/usr/share/zsh/site-functions/_hub"

  install -Dm644 "$srcdir/$_pkgdir"*"/man/$pkgname.1" "$pkgdir/usr/share/man/man1/$pkgname.1"

}
